﻿<%@ Page Title="广告位列表页" Language="C#" MasterPageFile="~/MasterPage/Main.master" AutoEventWireup="true" CodeFile="advertSpaceList.aspx.cs" Inherits="advertSpaceList" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<asp:Content ID="Content1" ContentPlaceHolderID="headcss" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<div class="ListHead">
    <h3>AdvertSpace List</h3>
</div>
<table style="width: 100%;" class="queryTable">
    <tr>
    <td colspan="8">    
        <input id="btnAdd" class="btn" onclick="openAddDetail();return false;" type="button" value="新增广告位" />
     </td>
    </tr>
</table>
<table cellpadding="0" cellspacing="1" border="0" class="TableList">
    <tr>
        <th style="width:15%;">广告位编号</th>
        <th>广告位名称</th>
        <th>广告位宽高</th>
        <th>广告上限</th>
        <th>有效广告数</th>
        <th>广告位类型</th>
        <th>显示类型</th>
        <th>操作</th>
    </tr>
    <tr>
        <td><asp:TextBox ID="txtSpaceNo" MaxLength="150" runat="server" Width="150px" CssClass="textbox"></asp:TextBox></td>
        <td><asp:TextBox ID="txtSpaceName" MaxLength="150" runat="server" Width="150px" CssClass="textbox"></asp:TextBox></td>
        <td>
        <asp:TextBox ID="txtWidth" MaxLength="150" runat="server" Width="60px" CssClass="textbox"></asp:TextBox>
        *
        <asp:TextBox ID="txtHeight" MaxLength="150" runat="server" Width="60px" CssClass="textbox"></asp:TextBox></td>
        <td></td>
        <td></td>
        <td>
        <asp:DropDownList ID="ddpSpaceType" runat="server" Width="155px" CssClass="select">
                <asp:ListItem Selected="True" Value="">Please Select</asp:ListItem>
                <asp:ListItem Value="1">常规广告</asp:ListItem>
                <asp:ListItem Value="2">关键词广告</asp:ListItem>
            </asp:DropDownList>
        </td>
        <td>
        <asp:DropDownList ID="ddpSourceType" runat="server" Width="155px" CssClass="select">
                <asp:ListItem Selected="True" Value="">Please Select</asp:ListItem>
                <asp:ListItem Value="1">文字广告</asp:ListItem>
                <asp:ListItem Value="2">图片广告</asp:ListItem>
                <asp:ListItem Value="3">Flash广告</asp:ListItem>
                <asp:ListItem Value="4">文字滚动广告</asp:ListItem>
                <asp:ListItem Value="5">图片滚动广告</asp:ListItem>
            </asp:DropDownList>
        </td>
        <td><asp:Button ID="btnSerach" CssClass="btn" class="btn" OnClick="btnSerach_Click" runat="server"  Text="筛选" /></td>
    </tr>
    <%if (AdvertSpaceList != null && AdvertSpaceList.Count > 0)
      { %>
    <%foreach (var advertspace in AdvertSpaceList)
      { %>
    <tr>
        <td><%=advertspace.SpaceNo%></td>
        <td><%=advertspace.SpaceName%></td>
        <td><%=advertspace.Width%>*<%=advertspace.Height%></td>
        <td><%=advertspace.MaxCount%></td>
        <td><%=advertspace.EffectiveCounts%></td>
        <td><%=advertspace.SpaceType%></td>
        <td><%=advertspace.SourceType%></td>
        <td style="text-align:center;"><a href="advertList.aspx?id=<%=advertspace.ID %>" target="_blank">查看广告</a>&nbsp;&nbsp;<a href="javascript:" onclick="openDetail(<%=advertspace.ID %>)">Edit</a>&nbsp;&nbsp;<a href="javascript:" onclick="deleteAdvertSpace(<%=advertspace.ID %>)">Delete</a></td>
    </tr>
    <%} %>
    <%} %>
</table>
<table style="width: 100%;" id="tblfoot" runat="server">
    <tr>
        <td style="width: 60%;">
            <webdiyer:AspNetPager ID="AspNetPager1" OnPageChanged="AspNetPager1_PageChanged"
                runat="server" PageIndexBoxType="DropDownList" ShowPageIndexBox="Always" AlwaysShow="True">
            </webdiyer:AspNetPager>
        </td>
        <td>
            总条数：<%=AspNetPager1.RecordCount%>
        </td>
        <td>
            总页数：<%=AspNetPager1.PageCount%>
        </td>
        <td>
            每页显示：<asp:DropDownList ID="ddlPageCount" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddlPageCount_SelectedIndexChanged">
                <asp:ListItem Value="5">5</asp:ListItem>
                <asp:ListItem Value="10" Selected="True">10</asp:ListItem>
                <asp:ListItem Value="30">30</asp:ListItem>
                <asp:ListItem Value="50">50</asp:ListItem>
                <asp:ListItem Value="100">100</asp:ListItem>
            </asp:DropDownList>
        </td>
    </tr>
</table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="footer" Runat="Server">
<script src="/js/common/My97DatePicker/WdatePicker.js" type="text/javascript" defer="defer"></script>
<script type="text/javascript">
    function openAddDetail(id) {
        OpenWindow("advertSpaceDetail.aspx?Action=add", "1000", "800");
    }
    function openDetail(id) {
        OpenWindow("advertSpaceDetail.aspx?Action=edit&id=" + id, "1000", "800");
    }
    function deleteAdvertSpace(id) {
        if (confirm("Are You Sure?")) {
            $.post("advertSpaceDelete.ashx", { advertSpaceID: id }, function (rValue) {
                if (rValue != "-1") {
                    window.location.href = window.location.href;
                }
            });
        }
    }
</script>
</asp:Content>

